package com.t2t.top;

import com.taobao.diamond.manager.DiamondManager;
import com.taobao.diamond.manager.ManagerListener;
import com.taobao.diamond.manager.impl.DefaultDiamondManager;

import java.util.concurrent.Executor;

public class DiamondClient {
    public static void main(String[] str) {
        DiamondManager manager = new DefaultDiamondManager("DEFAULT_GROUP", "keyTest",new MyManagerListener());

        //设置diamond-server服务的端口
        manager.getDiamondConfigure().setPort(8003);

        String availableConfigureInfomation = manager.getAvailableConfigureInfomation(5000);
        System.out.println("start config: " + availableConfigureInfomation);
    }
}

//填写你服务端后台保存过的group和dataId
class MyManagerListener implements ManagerListener{

    @Override
    public Executor getExecutor() {
        System.out.println("changed config: 1");
        return null;
    }

    @Override
    public void receiveConfigInfo(String configInfo) {
        System.out.println("changed config: " + configInfo);
    }
}